format amount in javascript

54

Number format in javascript -

function numberWithCommas(x) {
    return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

Comments

Submit
0 Comments